import request from '@/utils/request'
/*
  * 获取商品详情
  * @param {String} id - 商品ID
  * @returns Promise
*/
export const findGoods = (id) => {
  return request('/goods', 'get', { id })
}
/*
  * 获取商品同类推荐|为猜喜欢
  * @param {String} id - 商品ID 传入相关推荐， 不传猜你喜欢
  * @param {Integer} limit
  * @returns Promise
*/
export const findRelevantGoods = ({ id, limit = 16 }) => {
  return request('/goods/relevant', 'get', { id, limit })
}
/*
  * 获取热销榜数据
  * @param {String} id - 商品id
  * @param {Integer} type - 1代表24小时热销榜 2代表周热销榜 3代表总热销榜
  * @param {Integer} limit - 获取个数
  * @returns Promise
*/
export const findHotGoods = ({ id, limit = 3, type = 1 }) => {
  return request('/goods/hot', 'get', { id, limit, type })
}
/*
  * 获取商品的评价统计信息
  * @param {String} id - 商品id
  * @returns Promise
*/
export const findGoodsCommentInfo = (id) => {
  // return request(`/goods/${id}/evaluate`, 'get')
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, 'get')
}
/*
  * 获取商品的评价列表
  * @param {String} id - 商品id
  * @param {Object} params - 帅选对象
  * @returns Promise
*/
export const findGoodsCommentList = (id, params) => {
  // return request(`/goods/${id}/evaluate`, 'get')
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, 'get', params)
}
